# Created by 黄景涛
# DATE 2024/5/7

import hashlib


def calculate_sha1(file_path):
    sha1 = hashlib.sha256()
    with open(file_path, 'rb') as f:
        while True:
            data = f.read(4096)
            if not data:
                break
            sha1.update(data)
    return sha1.hexdigest()


file_path = 'data.txt'  # 文件路径
sha256_value = calculate_sha1(file_path)
print(f"{file_path}文件，SHA-256值: 【{sha256_value}】")
